package com.android.equipment.ui.dialog

import android.content.Context
import com.android.equipment.R
import com.android.equipment.adapter.DeviceNodeAdapter
import com.android.equipment.bean.RealDataBean
import com.android.equipment.databinding.DialogDeviceNodeDetailBinding
import com.luck.picture.lib.utils.DensityUtil
import com.lxj.xpopup.core.CenterPopupView

class DeviceNodeDetailDialog(context: Context,
                             val workId: Long,
                             val deviceCode: String,
                             val isHaveAlam: Boolean,
                             val dataList: MutableList<RealDataBean>): CenterPopupView(context) {
   var deviceNodeAdapter: DeviceNodeAdapter?= null
    val binding: DialogDeviceNodeDetailBinding by lazy {
        DialogDeviceNodeDetailBinding.bind(popupImplView)
    }

    override fun getImplLayoutId(): Int {
        return R.layout.dialog_device_node_detail
    }

    override fun getMaxHeight(): Int {
        return DensityUtil.dip2px(context,561f)
    }

    override fun onCreate() {
        super.onCreate()

        binding.ivClose.setOnClickListener {
            dismiss()
        }

        deviceNodeAdapter = DeviceNodeAdapter(workId,deviceCode)
        deviceNodeAdapter?.isHaveAlam(isHaveAlam)
        binding.rvNode.adapter = deviceNodeAdapter
        deviceNodeAdapter?.setList(dataList)


    }
}